package com.order.controller;

import com.alibaba.fastjson.JSON;
import com.order.bean.OrderDetail;
import com.order.service.OrderDetailService;
import com.order.service.impl.OrderDetailServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "OrderDetailController", value = "/orderDetail/*")
public class OrderDetailController extends BaseController {

    private OrderDetailService orderDetailService = new OrderDetailServiceImpl();

    protected void queryAll(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String json = request.getReader().readLine();
        OrderDetail orderDetail = JSON.parseObject(json, OrderDetail.class);
        List<OrderDetail> orderDetails = orderDetailService.queryAll(orderDetail);
        this.writeResultAndData(response, orderDetails);
    }

}
